//
//  LMPostsModel.m
//  EPA
//
//  Created by lanou3g on 16/4/22.
//  Copyright © 2016年 liman. All rights reserved.
//

#import "LMPostsModel.h"
#import "LMTextModel.h"
#import "LMImageModel.h"

@implementation LMPostsModel
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{

    
}

-(void)setValue:(id)value forKey:(NSString *)key{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"counterList"]) {
        
        [self setValuesForKeysWithDictionary:value];
    }
    if ([key isEqualToString:@"userinfo"]) {

        [self setValuesForKeysWithDictionary:value];
    }
}

+ (instancetype)modelWithDictionary:(NSDictionary *)dictionary{
    NSString *value = dictionary[@"coverimg"];
    if ([value isEqualToString:@""]) {
        LMTextModel *model = [LMTextModel new];
        [model setValuesForKeysWithDictionary:dictionary];
        return model;
    }else{
        LMImageModel *model = [[LMImageModel alloc]init];
        [model setValuesForKeysWithDictionary:dictionary];
        return model;
    }
    return nil;
}
@end
